/**
 * Created with IntelliJ IDEA.
 * User: 花海
 * Date: 2022-07-29
 * Time: 9:46
 */
public class CheakNumberOfNine {
    public static int cheak(int num){
        int i=0;
        while(num!=0){
            if(num%10==9){
                i++;
            }
          num/=10;  
        }
        return i;
    }

    public static void main(String[] args) {
        int sum=0;
        for (int i = 1; i <=100 ; i++) {
            sum+=cheak(i);
        }
        System.out.println("the number of 9 is"+sum);
    }
}
